package com.alibaba.dubbo.demo.consumer;

import java.util.concurrent.TimeUnit;

import com.alibaba.dubbo.demo.DemoService;
import com.alibaba.dubbo.demo.Student;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Consumer4 {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"META-INF/spring/dubbo-demo-consumer.xml"});
        context.start();
        DemoService demoService = (DemoService) context.getBean("demoService4"); // get remote service proxy

        try {
        	Student st = new Student();
        	st.setName("zsl");
        	st.setAge(10);
        	Student st2 = demoService.sayHello(st); // call remote method
            System.out.println("go no");
            System.out.println("=====" + st2);
            
            Student st3 = demoService.sayHello(st);
            TimeUnit.MINUTES.sleep(1000);
        } catch (Throwable throwable) {
        	try {
				TimeUnit.MINUTES.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
            throwable.printStackTrace();
        }
    }
}
